﻿public class Actor
{
    private LogicStateMachine _logicStateMachine;
    private StepEffectManager _stepEffectManager;
    private AvatarInfo _avatarInfo;

    public void InitActor(AvatarInfo avatarInfo)
    {
        InitData(avatarInfo);
        InitFSM();
        InitStepEffect();
    }

    private void InitData(AvatarInfo avatarInfo)
    {
        _avatarInfo = avatarInfo;
    }

    private void InitFSM()
    {
        _logicStateMachine = new LogicStateMachine(this);
        _logicStateMachine.gotoState(LogicStateType.Logic_State_Stand);
    }

    private void InitStepEffect()
    {
        _stepEffectManager = new StepEffectManager(this);
    }

    public void Update(float deltaTime)
    {
        if (_logicStateMachine != null)
        {
            _logicStateMachine.Update(deltaTime);
        }

        if (_stepEffectManager != null)
        {
            _stepEffectManager.Update(deltaTime);
        }
    }

    public void LateUpdate(float deltaTime)
    {
        if (_logicStateMachine != null)
        {
            _logicStateMachine.LateUpdate(deltaTime);
        }
    }

    public AvatarInfo GetAvatarInfo()
    {
        return _avatarInfo;
    }
}